<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<html>
<head>
<meta charset="UTF-8">
<title>我的账户-重置密码</title>
<jsp:include page="/include/wchat/head.jsp"></jsp:include>

<link type="text/css" rel="stylesheet" href="/v2/wchat/resrc/css/account.css">
<script type="text/javascript">

/**
 * 重置密码
 */
function resetPwd() {
	//密码
	var $password = $('#password');
	//确认密码
	var $rePassword = $('#rePassword');
	//信息提示
	var $errorMsg = $('#errorMsg');
	
	//检验密码
	if ($password.val() == null || $password.val() == '') {
    	$errorMsg.html('请输入密码').show();
    	return false;
	}
	//检验确认密码
	if ($rePassword.val() == null || $rePassword.val() == '') {
    	$errorMsg.html('请输入确认密码').show();
    	return false;
	}
	if ($rePassword.val() != $password.val()) {
    	$errorMsg.html('两次输入密码不一致').show();
    	return false;
	}
	var param = {};
    param["paramMap.pwd"] = $password.val();
    param["paramMap.rePassword"] = $rePassword.val();
	
	//异步请求
	$.ajax({
		type: 'POST',
		url: environment.basePath + "/resetPwd.do",
		data: param,
		success: function(data) {
			//错误等信息提示
			if(data.code < 0){
				$errorMsg.html(data.msg).show();
				return false;
			}
			
			//跳转至验证手机号成功页面
			window.location.href = environment.basePath + "/resetPwdSuccessByMobile.do";
		}
	});//End...$.ajax
}

</script>
</head>
<body>
<div id="header"> 
	<a href="javascript:history.go(-1);" class="backto">返回</a>
	<div class="title-sub">找回密码</div>
</div>
<div id="wrap">
	<div class="resetpwd">
		<div class="itip">即将重置密码的账户为：${session.findPwdMap.username}</div>
		<div class="link-touch">
			<ul class="items">
				<li>
					<label class="txt">密码</label>
					<input type="password" id="password" class="input" placeholder="请输入密码" maxlength="16">
				</li>
				<li>
					<label class="txt">确认</label>
					<input type="password" id="rePassword" class="input" placeholder="请输入确认密码" maxlength="16">
				</li>
			</ul>
			<div id="errorMsg" class="vtip errs none">两次输入密码不一致</div>
		</div>
	<div class="operate-button operate-acc"> <a href="javascript:;" class="btn" onclick="return resetPwd();">重置密码</a></div>
	</div>
</div>

<jsp:include page="/include/wchat/footer.jsp"></jsp:include>
</body>
</html>